package com.dushuren.project.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dushuren.project.model.dto.TeamAddRequest;
import com.dushuren.project.model.dto.TeamListQueryRequest;
import com.dushuren.project.model.dto.TeamUpdateBaseRequest;
import com.dushuren.project.model.dto.TeamUpdateCureRequest;
import com.dushuren.project.model.entity.Team;
import com.dushuren.project.model.vo.TeamVo;
import com.dushuren.project.model.vo.UserVo;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author qieqie
* @description 针对表【team(队伍管理)】的数据库操作Service
* @createDate 2022-10-17 08:34:21
*/
public interface TeamService extends IService<Team> {

  /***
   * 创建队伍
   * @param teamAddRequest 队伍信息
   * @param request 登录态
   * @return 是否成功
   */
  Boolean addTeam(TeamAddRequest teamAddRequest, HttpServletRequest request);

  /**
   * 删除队伍
   * @param id
   * @param request
   * @return
   */
  Boolean deleteTeam(Long id, HttpServletRequest request);

  /***
   * 更新队伍基础信息
   * @param teamUpdateBaseRequest
   * @param request
   * @return
   */
  Boolean updateBaseTeam(TeamUpdateBaseRequest teamUpdateBaseRequest, HttpServletRequest request);

  /***
   * 更新公开的队伍信息
   * @param updateCureRequest
   * @param request
   * @return
   */
  Long updateCureTeam(TeamUpdateCureRequest updateCureRequest, HttpServletRequest request);

  /***
   * 查询指定队伍信息(通过 | 审核 | 拒绝)
   * @param teamListQueryRequest
   * @param teamState
   * @return
   */
  List<TeamVo> listQueryTeam(TeamListQueryRequest teamListQueryRequest, Integer teamState);

  /***
   * 分页查询指定队伍信息(通过 | 审核 | 拒绝)
   * @param teamListQueryRequest
   * @param teamState
   * @return
   */
  Page<TeamVo> listPageQueryTeam(TeamListQueryRequest teamListQueryRequest, Integer teamState);


  /***
   * 校验team表中这个Id是否存在，teamApplyState是否为0
   * @param teamId
   * @return
   */
  Boolean checkApplyState(Long teamId);

  /**
   * 队伍的人数是否已满 需要查询队伍的最大人数 、 查询队伍现在已有多少人数 返回现在还可以加入多少人
   * @param teamId
   * @return
   */
  Long teamWantingAmount(Long teamId);


  /**
   * 获取当前队伍中所有成员信息
   */
  List<UserVo> allMember(Long teamId);

}
